package com.eud.web.servlet;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.eud.dao.MovieDao;
import com.eud.dao.impl.MovieDaoImpl;
import com.eud.entity.Movie;
import com.eud.service.MovieService;
import com.eud.service.impl.MovieServiceImpl;

/**
 * Servlet implementation class MovieFirstServlet
 */
@WebServlet("/MovieFirstServlet")
public class MovieFirstServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public MovieFirstServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		HttpSession session = request.getSession();
		MovieDao md=new MovieDaoImpl();
		MovieService m=new 	MovieServiceImpl();
		List<Movie> l=m.queryF();
		List<Movie> l2=m.queryFs();
		List<Movie> l3=m.queryByp();
		List<Movie> l4=md.queryF4();
		Map<String,List<Movie>> map=new HashMap<String,List<Movie>>();
		map.put("l",l);
		map.put("l2",l2);
		map.put("l3",l3);
		map.put("lm",l4);
		session.setAttribute("map", map);
		request.getRequestDispatcher("index.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
